#pragma once

#include "LayerBase.h"
#include "NodeContainerItemManager.h"
#include "entity/GLPrivatePack.h"
#include "ui/UIButton.h"

class CLayerContainerPack : public CLayerBase {
public:
	CLayerContainerPack(void);
	virtual ~CLayerContainerPack(void);
	CREATE_FUNC(CLayerContainerPack);

	bool init() override;
	virtual void onEnter() override;
	//virtual void onExit() override;
	//virtual void update(float delta) override;

	void UpdateContent();
private:
	void updateItem(cocos2d::Node* node, const CNodeContainerItemManager::ItemContent& content);
	void onShowItemDetail(cocos2d::Ref* pSender, cocos2d::ui::TouchEventType type);
	void onOpGoods(cocos2d::Ref* pSender, cocos2d::ui::TouchEventType type);
	void onClosePack(cocos2d::Ref* pSender, cocos2d::ui::TouchEventType type);
private:
	cocos2d::Node*				m_Pack;
	CNodeContainerItemManager	m_Items;

	cocos2d::Node*				m_ItemDetail;
	cocos2d::ui::Button*		m_ItemDetailOp;

	CGLPrivatePack*				m_EntityPack;
};

